package com.qboot.rabbitmq.work;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 任务模型 Work - 多个消费者
 *
 * @author Tellsea
 * @date 2023/3/7
 */
@Component
public class WorkConsumer {

    /**
     * 消费者A
     *
     * @param msg
     */
    @RabbitListener(queuesToDeclare = @Queue(WorkConst.QUEUE_NAME))
    public void listenA(String msg) {
        System.out.println("WorkConsumer listenA 接收到消息：" + msg);
    }

    /**
     * 消费者B
     *
     * @param msg
     */
    @RabbitListener(queuesToDeclare = @Queue(WorkConst.QUEUE_NAME))
    public void listenB(String msg) {
        System.out.println("WorkConsumer listenB 接收到消息：" + msg);
    }
}
